Skip to content

Conversation

jkeenan
Copy link
Contributor

@jkeenan jkeenan commented Oct 6, 2025

Provide simple examples of goto &NAME syntax used incorrectly.

Fixes: GH #23811


  • This set of changes does not require a perldelta entry.

Copy link
Contributor

@mauke mauke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see what this has to do with #23811.

It looks like you're trying to test the Can't goto subroutine from an eval-block error, but we already have a test for that (line 205).

The goto &{ ... } and goto &$foo syntax variants are already exercised by lines 345 and 260 in this file.

# GH 23811 goto &NAME where block evaluates to coderef
{
local $@;
my $hw = 'hello world';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is $hw for?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is $hw for?

The same string is used at lines 382, 391 and 400; hence, store in a variable.

t/op/goto-sub.t Outdated
like($@, qr/^Can't goto subroutine from an eval-block/,
"Can't goto subroutine (block which evaluates to coderef) from an eval block");

undef $@;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

undef $@ is redundant before eval. Every eval resets $@.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed in two locations in next push; thanks.

@jkeenan jkeenan self-assigned this Oct 9, 2025
Provide simple examples of goto &NAME syntax used incorrectly.

Addresses: GH Perl#23811

Remove two superfluous statements, per review by @mauke.
@jkeenan jkeenan force-pushed the goto-amp-name-20251006 branch from de676ae to d0a88a3 Compare October 18, 2025 22:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants